export default (_self, h) => {
	return h(
		"el-checkbox-group",
		{
			props: {
				value: _self.obj.value || [],
			},
			attrs: {
				disabled: !_self.obj.status,
			},
			on: {
				change() {
					let flag = true;
					console.log(event.target.value);
					console.log(_self.obj.value);
					_self.obj.value.map((item, i) => {
						if (item == event.target.value) {
							_self.obj.value.splice(i, 1);
							flag = false;
							return;
						}
					});
					if (flag === false) return;
					_self.obj.value.push(event.target.value);
					console.log(_self.obj.value);
				},
			},
		},
		_self.obj.detailList.map(v => {
			return h(
				"el-checkbox",
				{
					props: {
						label: v.label,
					},
				},
				v.value
			);
		})
	);
};

export const checkBoxConf = {
	status: true, // 启用状态，0启用；1停用
	elementWidth: "100%",
	elementType: "checkBox", // 对应数据库内类型
	elementName: "多选框", // 控件左侧label内容
	value: [], // 绑定的值
	detailList: [
		// 选项内数据
		{
			key: 0,
			label: "选项框1",
			value: "选项框1",
		},
		{
			key: 1,
			label: "选项框2",
			value: "选项框2",
		},
	],
	key: 2, // 配置的起始key
	icon: "el-icon-circle-check",
	required: false, // 是否必填,
	rules: [],
};
